//渠道、产品公共查询方法
/*
 * 标签模板：channel
 * <div class="form-group col-xs-12 col-sm-3 col-md-3 col-lg-3">
	<label class="col-sm-6 control-label"
		style="text-align: right" for="sex">渠道</label>
	<div class="col-sm-6">
		<select id="channel" name="channel"><lect>
	</div>
</div>*/

function loadProduct() {
	$.ajax({
		type : 'POST',
		dataType : 'json',
		url : ctx + "/getQueryCondition/getProductList.action?rand="
				+ Math.random(),
		timeout : 300000,
		success : function(resp) {

			var data = resp["aaData"];
			var prdid = '<option value="">请选择</option>';

			for (var i = 0; i < data.length; i++) {
				prdid += '<option value="' + data[i]["prdid"] + '">'
						+ data[i]["prdName"] + '</option>';
			}
			$("#prdid").html(prdid);
		},
	});
}

function loadChannel() {
	$.ajax({
		type : 'POST',
		dataType : 'json',
		url : ctx + "/getQueryCondition/getChannelList.action?rand="
				+ Math.random(),
		timeout : 300000,
		success : function(resp) {
			var data = resp["aaData"];
			var channel = '<option value="">不限</option>';

			for (var i = 0; i < data.length; i++) {
				channel += '<option value="' + data[i]["channelCode"] + '">'
						+ data[i]["channelName"] + '</option>';
			}
			$("#channel").html(channel);
		}
	});
}

function loadProvince() {
	$.ajax({
		type : 'POST',
		dataType : 'json',
		url : ctx + "/getQueryCondition/getProvinceList.action?rand="
				+ Math.random(),
		timeout : 300000,
		success : function(resp) {
			hideLoading();
			var data = resp["aaData"];
			var province = '<option value="">不限</option>';

			for (var i = 0; i < data.length; i++) {
				province += '<option value="' + data[i]["abbr"] + '">'
						+ data[i]["abbr"] + '</option>';
			}
			$("#province").html(province);
		},
	});
}

//查询所有贷款活动
function queryAllLoanActivity() {
	$.ajax({
		type : 'POST',
		dataType : 'json',
		url : ctx + "/loanactivity/queryloanlist.action?rand=" + Math.random(),
		timeout : 300000,
		success : function(resp) {
			hideLoading();
			var data = resp["aaData"];
			var loan_product = "";
			for (var i = 0; i < data.length; i++) {
				loan_product += '<option value="' + data[i]["id"] + '">'
						+ data[i]["name"] + '</option>';
			}
			$("#loan_product").html(loan_product);
		},
	});
}

//查询所有贷款活动
function queryLoanActivityList() {
	$.ajax({
		type : 'POST',
		dataType : 'json',
		url : ctx + "/loanactivity/queryloanlist.action?rand=" + Math.random(),
		timeout : 300000,
		success : function(resp) {
			hideLoading();
			var data = resp["aaData"];
			var loan_product = "<option value=''>请选择</option>";
			for (var i = 0; i < data.length; i++) {
				loan_product += '<option value="' + data[i]["id"] + '">'
						+ data[i]["name"] + '</option>';
			}
			$("#loan_product").html(loan_product);
		},
	});
}

